<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="console"></div>

<script>
    doc = (new DOMParser).parseFromString("<doc><elem>1</elem><elem>2</elem></doc>", "application/xml");

    expr = doc.createExpression("1", null);

    shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
    shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'1'");

    expr = doc.createExpression(".", null);

    shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
    shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'2'");

    expr = doc.createExpression("string(.)", null);

    shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
    shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'2'");

    expr = doc.createExpression("1 + .", null);

    shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.NUMBER_TYPE, null).numberValue", "2");
    shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.NUMBER_TYPE, null).numberValue", "3");

</script>
</body>
</html>
